﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Haolaike._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <meta charset="utf-8" />
    <!-- no cache-->
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Progma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache,must-revalidate" />
    <title>首页</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
    <link rel="stylesheet" type="text/css" href="css/Site.css" />
    <link rel="stylesheet" type="text/css" href="css/theme.css" />
    <link rel="stylesheet" type="text/css" href="css/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="css/icon.css" />
    <script src="js/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="js/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="js/Common.js" type="text/javascript"></script>
    
    <style type="text/css">
        #topMessage
        {
            font-weight: bold;
            margin: 20px;
            padding: 5px;
            border-width: 1px;
            border-style: groove;
        }
    </style>
</head>
<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<body>
    <!--<![endif]-->
    <form runat="server" id="form1">
    <div style="position: absolute; text-align: center; top: 0px; left: 300px; background-color: Red;
        color: White; font-size: 12px; z-index: 10000; vertical-align: middle; display: none;"
        id="topMessage">
    </div>
    
    <div class="navbar">
        <div id="topnav">
            <div id="logo">
                <table width="100%" cellpadding="-1" cellspacing="-1" style="height: 100%;">
                    <tr>
                        <td>
                            <img alt="logo" src="<%=ResolveClientUrl("~/images/logo.gif")%>" />
                        </td>
                        <td>
                            <div style="position: absolute; top: 2px; left: 22px; color: #DDDDDD; font-family: Arial;
                                width: 350px; font-size: 20px; font-weight: bold; font-style: italic; height: 100%;
                                z-index: 99;">
                                好莱客
                            </div>
                        </td>
                        <td align="right" style="width: 494px; background: #2770A0 url(<%=ResolveClientUrl("~/images/top4.jpg")%>) no-repeat left top;">
                            <div id="Version" runat="server" style="position: relative; top: 5px; font-size: 10px;
                                color: #BBBBBB; font-weight: bold; font-family: Verdana; font-style: italic;">
                                V1.0
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div id="user-section">
            <div id="menucontent">
                <table style="width: 100%">
                    <tr>
                        <td>
                            <span id="menuSpan"></span>
                        </td>
                        <td width="100%" align="right">
                            <a href="#" style="font-size: 12px" id="StranLink">繁体中文</a> &nbsp; <span id="topUserName"
                                runat="server"></span>&nbsp;
                            <input type="hidden" id="doLogout" runat="server" value="0" />
                            <span style="padding-right: 10px"><a id="editPwd" href="javascript:void(0)">修改密码</a>
                            </span><a id="logout" href="javascript:void(0)">登出</a>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    
    <div class="content">
        <div id="subpage" style="display: none">
            <div id="pageContainer" class="easyui-tabs" style="width: 1000; height: 1000;">
            </div>
        </div>
        <div id="desktop">
            <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                <tr height="28">
                    <td background="images/title_bg1.jpg" style="padding-left: 20px">
                        首页
                    </td>
                </tr>
                <tr>
                    <td bgcolor="#b1ceef" height="1">
                    </td>
                </tr>
                <tr height="20">
                    <td background="images/shadow_bg.jpg">
                    </td>
                </tr>
            </table>
            <table width="90%" align="center">
                <tr height="100">
                    <td align="middle" width="100">
                        <img alt="admin" height="100" src="images/admin_p.gif" width="90" />
                    </td>
                    <td width="60">
                        &nbsp;
                    </td>
                    <td>
                        <table height="100" width="100%">
                            <tr>
                                <td>
                                    <span id="currTime"></span>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <span style="font-weight: bold; font-size: 16px" id="UserName" runat="server"></span>
                                    <div style="padding-top: 20px;">
                                        欢迎进入 好莱客 系统！</div>
                                </td>
                            </tr>
                        </table>
        </div>
        <div id="dlgContainer">
            <div id="dlg" class="easyui-dialog" style="padding: 2px 2px;" modal="true" closed="true">
                <iframe frameborder="0" id="dlgFrm" scrolling="no" style="overflow: hidden;"></iframe>
            </div>
        </div>
    </div>
    
    <script type="text/javascript">
        var main = {
            closeDlg: function (success) {
                $('#dlg').dialog('close');
                if (success && this.dialogCallback) {
                    this.dialogCallback();
                    this.dialogCallback = null;
                }
            },
            wHeight: function () { return $(window).height(); },
            wWidth: function () { return $(window).width(); },
            editRow: null,

            //弹窗
            dialog: function (left, top, width, height, title, url, callback, param) {
                if (callback) this.dialogCallback = callback;
                if (param) this.editRow = param;
                $('#dlg').dialog({ title: title, top: top, left: left, width: width, height: height, resizable: true,
                    onOpen: function () {
                        var panel = $(".panel-body:last");
                        $('#dlgFrm').width(width - 25).height(height - 40).attr("src", url);

                    },
                    onClose: function () {
                        $('#dlgFrm').attr("src", "about:blank");
                        if (main.dialogCallback) {
                            main.dialogCallback();
                            main.dialogCallback = null; 
                        }
                    }
                }).dialog('open');
            },
            doMessageCallback: function () {
                $('#topMessage').hide();
                if (this.messageCallback) {
                    this.messageCallback();
                    this.messageCallback = null;
                }
            },
            messageCallback: null,
            showMessage: function (msg, success, callback) {
                if (callback) this.messageCallback = callback;
                // 错误提示
                var nDivLeft = $(window).width();
                var nDivTop = $(window).height();
                var color = "red";
                var span = 2500;
                if (success) {
                    color = "green";
                    span = 1000;
                }
                else {
                    if (msg.indexOf("登录超时") > -1) {
                        main.relogin();
                        return;
                    }

                }
                $("#topMessage").html($.escapeHTML(msg)).css({ "left": (nDivLeft - parseInt($("#topMessage").width())) / 2, "top": (nDivTop - parseInt($("#topMessage").height())) / 2, "background-color": color }).show();
                setTimeout("main.doMessageCallback()", span);

            },
            relogin: function () {
                window.location.href = $.format("http://{0}{1}/Login.aspx?relogin=true", window.location.host, appPath);
            },
            resizeTab: function () {
                if ($('#pageContainer').tabs("tabs").length > 0) {
                    var wHeight = main.wHeight() - $(".navbar").outerHeight() - $(".tabs-header").outerHeight();
                    var wWidth = main.wWidth();
                    if (wHeight < 300) wHeight = 300;
                    if (wWidth < 600) wWidth = 600;
                    var activePnl = $('.tabs-panels >.panel:visible ');
                    if (activePnl.length > 0) {
                        activePnl.find(".panel-body").width(wWidth);
                        activePnl.find('iframe').height(wHeight);
                        var ifrm = activePnl.find('iframe')[0].contentWindow;
                        //调用子窗口的resize
                        if (ifrm.pageJs) ifrm.pageJs.resize(wHeight, wWidth);
                    }
                }
            },

            navigate: function (url, title, key) {
                //隐藏默认
                $('#desktop').hide();
                $('#subpage').show();
                if ($('#pageContainer').tabs("exists", title)) {
                    //已经存在直接显示
                    $('#pageContainer').tabs('select', title);
                    //重计算大小
                    $(window).resize();
                }
                else {
                    var frmHeight = $(window).height() - $(".navbar").height() - $(".tabs-header").height();
                    $('#pageContainer').tabs('add', {
                        title: title,
                        content: $.format("<div><iframe scrolling=\"no\" frameborder=\"0\"  style=\"width:100%; height:{2}px;\" src=\"Page/{1}\"  id=\"Frm{0}\" name=\"Frm{0}\"> </iframe></div>", key, url, frmHeight),
                        closable: true,
                        tools: [{
                            iconCls: 'icon-mini-refresh',
                            handler: function () {
                                // $('#pageContainer').tabs('getSelected').find("iframe")[0].location.reload();
                                window.document.frames[$.format("Frm{0}", key)].location.reload();
                            }
                        }]
                    });
                    //记录登录日志
                    var parm = { FUNCTION_NAME: title, FUNCTION_KEY: key };
                    $.post("Ashx/System/hUserGroup.ashx?action=loginlog", "data=" + JSON.stringify(parm), function (result) {

                    }, "json");
                }

            },
            downLoadFile: function (operate, objName, fileName) {
                var divExport = top.document.getElementById("SysDownData").contentWindow.document.getElementById("divParam");
                $(divExport).find("#operate").val(operate);
                $(divExport).find("#objName").val(objName);
                $(divExport).find("#fileName").val(fileName);
                top.document.getElementById("SysDownData").contentWindow.document.forms[0].submit();

            }



        }

        $(function () {

            for (var i = 0; i < menus.length; i++) {
                var menu = menus[i];
                var subMenuString = "";
                var menuType;
                var ssMenu;
                $("#menuSpan").append($.format("<a href='javascript:void(0)' id='mb{0}' class='easyui-menubutton' >{1}</a> <div id='mm{0}' style='width:150px'></div>", i, menu.text));
                for (var j = 0; j < menu.subMenu.length; j++) {
                    var subMenu = menu.subMenu[j];
                    menuType = subMenu.type;
                    //菜单
                    if (menuType == 1) subMenuString += $.format("<div onclick=\"main.navigate('{2}','{0}',{3})\" title='{1}'>{0}</div> ", subMenu.text, subMenu.ToolTip, subMenu.href, subMenu.key);
                    //目录,最多三级
                    else {
                        subMenuString += $.format("<div> <span title='{1}' >{0}</span>  <div style='width:150px;'>  ", subMenu.text, subMenu.ToolTip);
                        for (var k = 0; k < subMenu.subMenu.length; k++) {
                            var ssMenu = subMenu.subMenu[k];
                            //菜单
                            if (ssMenu.type == 1) subMenuString += $.format("<div onclick=\"main.navigate('{2}','{0}',{3})\" title='{1}'>{0}</div> ", ssMenu.text, ssMenu.ToolTip, ssMenu.href, ssMenu.key);
                        }
                        subMenuString += "</div></div> ";

                    }
                }
                $('#mm' + i).append(subMenuString);
                $('#mb' + i).menubutton({
                    menu: '#mm' + i
                });
            }

            $('#editPwd').click(function () {
                BasicJs.dialog(500, 470, "修改密码", "Page/System/editPwd.aspx?time=" + (new Date()).getTime(), function () { });
            });
            $('#logout').click(function () {

                $.messager.confirm('退出系统', '确定要退出吗？', function (r) {
                    if (r) {
                        $("#doLogout").val("1");
                        $("#form1").submit();
                    }
                });
            });
            $('#pageContainer').tabs({
                onClose: function () {
                    if ($('#pageContainer').tabs("tabs").length == 0) {
                        $('#desktop').show();
                        $('#subpage').hide();
                    }
                },
                onSelect: function (title, index) {
                    main.resizeTab();
                    document.title = title;
                    $(".icon-mini-refresh").attr("title", "刷新");

                }
            });
            $('#currTime').html("当前时间：" + (new Date()).format("yyyy-MM-dd hh:mm"));

            $('#frmNav,.content').height(main.wHeight() - $(".navbar").outerHeight());
            $(window).resize(function () {
                $('#frmNav,.content').height(main.wHeight() - $(".navbar").outerHeight());
                main.resizeTab();

            });

        });
    </script>
    </form>
    <div style="display: none;">
        <iframe id="SysDownData" src="Page/Flow/DownloadFile.aspx"></iframe>
    </div>
    <script src="js/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <%--简繁转换--%>
    <script src="../js/Language.Js" type="text/javascript"></script>
</body>
</html>
